#ifndef __SCNS_SD_H__
#define __SCNS_SD_H__

#include "ScnsConfig.h"

#if defined(SCNS_SD_ENABLE)&&SCNS_SD_ENABLE==1

#include "ScnsBspSd.h"

#include "ScnsYing.h"

typedef enum
{
    SCNS_SD_TYPE_ERR=0X00,
    SCNS_SD_TYPE_MMC=0X01,
    SCNS_SD_TYPE_V1=0X02,
    SCNS_SD_TYPE_V2=0X04,
    SCNS_SD_TYPE_V2HC=0X06,
}scnsSdType;

typedef enum
{
    SCNS_SD_STATUS_OK=SCNS_YING_STATUS_OK,
    SCNS_SD_STATUS_BSP_FAILED=SCNS_YING_STATUS_BSP_FAILED,
    SCNS_SD_STATUS_FAILED=SCNS_YING_STATUS_FAILED,
    SCNS_SD_STATUS_HANDSHAKE_FAILED,
    SCNS_SD_STATUS_NOT_PLUGIN,
    SCNS_SD_STATUS_NOT_INITED,
    SCNS_SD_STATUS_KEY_ERROR,
}ScnsSdStatus;

extern ScnsSdStatus ScnsSdPlugIn(void);
extern ScnsSdStatus scnsSdInit(void);
extern ScnsSdStatus scnsSdHandshake(void);
extern ScnsSdStatus scnsSdInited(void);

extern uint8 scnsSdRead(uint8*buf,uint32 sector,uint8 cnt);
extern uint8 scnsSdWrite(const uint8*buf,uint32 sector,uint8 cnt,uint32 tryTime);

extern uint8 scnsSdTest(void);
#if defined(SCNS_SD_FATFS_DIR)
#include "ff.h"
#include "diskio.h"
extern DRESULT scnsSdIoctl(BYTE cmd,void*buff);
#endif
#endif
#endif
